<template>
  <div>
    <h1 ref="h1">我是A组件</h1>
    <h2 ref="h2">ref调用组件</h2>
  </div>
</template>

<script>

export default{
  name: 'A-Comp',
  components: {},
  data(){
    return {
      text:'xxx'
    }
  },
  mounted(){
    this.$refs.h2.style.color = 'red'
  },
  methods:{
    changeColor(color){
      this.$refs.h1.style.color = color;
    },
    changeColorH2(color){
      this.$refs.h2.style.color = color;
    }
  }
};
</script>

<style scoped lang='scss'>

</style>